package com.yoomiito.app.adapter;

import androidx.viewpager.widget.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

/**
 * Created by Administrator on 2017/12/24 0024 14:36.
 */

public class VPAdapter extends PagerAdapter {
    private List<View> res;
    public VPAdapter(List<View> res) {
        this.res = res;
    }

    @Override
    public int getCount() {
        return res.size();
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView(res.get(position));
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        container.addView(res.get(position));
        return res.get(position);
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }

}
